﻿/********************************************************************
	created:	2011-8-10   7:58
	author:		Lifan Su
	
	purpose:	provide platform-dependent macros.
                this is a stand-alone header
*********************************************************************/

#ifndef CONFIGURE_H
#define CONFIGURE_H


/*
 *  This section is used to detect the endianness of target platform.
 *  In order to speedup convert between integer and byte-array.
 *  Currently works with VC 16.00.
 */

#if defined _MSC_VER
    #if defined _M_IX86 || defined _M_X64 || defined _M_AMD64
        #define __LITTLE_ENDIAN__
    #else
        #error "Unsupported Platform"
    #endif // M_X86 || M_X64 || M_AMD64
#else
    #error "Unsupported Platform!"
#endif // _MSC_VER

/*
 *  This section is used to detect if the target platform supports
 *  unaligned read/write operations
 */
#if defined _MSC_VER
    #if defined _M_IX86 || defined _M_X64 || defined _M_AMD64
        #define __NO_ALIGN_REQ__
    #else
        #error "Unsupported Platform"
    #endif // M_X86 || M_X64 || M_AMD64
#else
    #error "Unsupported Platform!"
#endif // _MSC_VER



/*
 *  This section is used to detect the platform is 32-bit or 64-bit
 *  ( I don't expect this program run on a 16-bit computer at all )
 */

#if defined _MSC_VER
    #if defined _M_IX86
        #define __32_BITS__
    #elif defined _M_X64 || defined _M_AMD64
        #define __64_BITS__
    #else
        #error "Unsupported Platform"
    #endif
#else 
    #error "Unsupported Platform"
#endif // _MSC_VER

#endif // CONFIGURE_H